package com.example.monit.controller;

import com.example.monit.bean.InterfaceIndicator;
import com.example.monit.bean.ResponseRust;
import com.example.monit.service.InterfaceIndicatorService;
import com.example.monit.vo.InterfaceIndicatorTotalVo;
import com.example.monit.vo.InterfaceIndicatorVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/performances")
public class InterfaceIndicatorController {
    @Autowired
    InterfaceIndicatorService interfaceIndicatorService;

    /**
     * 数据插入
     */
    @PostMapping("/interfaceindicators")
    public ResponseRust interfaceIndicatorLoad(@RequestBody List<InterfaceIndicator> interfaceIndicator) throws IOException {
        return this.interfaceIndicatorService.upLoadInterfaceIndicator(interfaceIndicator);
    }

    /**
     * 数据查询接口
     */
    @GetMapping("/interfaceindicators")
    public ResponseRust getInterfaceIndicator(InterfaceIndicatorVo interfaceIndicatorVo) throws IOException {
        return this.interfaceIndicatorService.queryInterfaceIndicator(interfaceIndicatorVo);
    }


    /**
     * 统计接口
     */
    @GetMapping("/interfaceindicatorstatistics")
    public ResponseRust interfaceIndicatorTotal(InterfaceIndicatorTotalVo interfaceIndicatorTotalVo) throws IOException {
        return this.interfaceIndicatorService.totalInterfaceIndicator(interfaceIndicatorTotalVo);
    }

}
